package com.example.tuomintest.controller;

import com.example.tuomintest.vo.UserVO;
import com.sun.org.slf4j.internal.Logger;
import com.sun.org.slf4j.internal.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
public class TestController {

    private static final Logger logger = LoggerFactory.getLogger(TestController.class);

    @RequestMapping ("test")
    public String test(){
        UserVO vo=new UserVO();
        vo.setUserName("张大仙");
        vo.setPhone("19172560819");
        vo.setAddress("广东省深圳市罗胡区笋岗街道129号");
        vo.setAge(18);

        log.info("日志脱敏----info：\r\n{}",vo);
        System.out.println("\t\n");

        log.error("日志脱敏----error：\r\n{}",vo);
        System.out.println("\t\n");

        //System.out.println("正常获取脱敏数据 userName："+vo.getUserName());
        log.info("日志脱敏vo.getUserName()：{}",vo.getUserName());
        System.out.println("\t\n");

        //System.out.println("正常获取脱敏数据 address："+vo.getAddress());
        log.info("日志脱敏vo.getAddress()：{}",vo.getAddress());
        System.out.println("\t\n");

        String phone = vo.getPhone();
        log.info("单独获取----info：vo.getPhone():{},phone:{}",vo.getPhone(),phone);

        return "userList";
    }


    /**
     * 这种方式run的方式是不进行脱敏的
     * */
    public static void main(String[] args) {
        UserVO vo=new UserVO();
        vo.setUserName("张三");
        vo.setAddress("广东省广州市天河区xxxxxx号");
        vo.setAge(18);
        log.info("日志脱敏----info：\r\n{}",vo);

    }


}
